﻿@using Aspire.Dashboard.Resources
@typeparam TItem
@inject IStringLocalizer<ControlsStrings> Loc

<FluentDataGrid Items="@Items"
                ResizableColumns="true"
                Style="width:100%"
                GenerateHeader="GenerateHeaderOption.Sticky"
                GridTemplateColumns="@GridTemplateColumns">
    <TemplateColumn Title="@(NameColumnTitle ?? Loc[nameof(ControlsStrings.NameColumnHeader)])" Class="nameColumn" SortBy="@NameSort" Sortable="@IsNameSortable">
        <GridValue Value="@NameColumnValue(context)" HighlightText="@HighlightText" />
    </TemplateColumn>
    <TemplateColumn Title="@(ValueColumnTitle ?? Loc[nameof(ControlsStrings.PropertyGridValueColumnHeader)])" Class="valueColumn" SortBy="@ValueSort" Sortable="@IsValueSortable">
        <GridValue Value="@ValueColumnValue(context)" HighlightText="@HighlightText"
                   EnableMasking="@EnableValueMasking" IsMasked="@GetIsItemMasked(context)"
                   IsMaskedChanged="(newValue) => OnIsMaskedChanged(context, newValue)" />
        @ExtraValueContent(context)
    </TemplateColumn>
</FluentDataGrid>

